if not ( RES_DISTRIB == 2 ) then Error("Please Install Resource Distribution 2 Addon.'" ) return end

TOOL.Category = '(Dominion Wars)'
TOOL.Name = '#Storage'
TOOL.Command = nil
TOOL.ConfigName = ''
if (CLIENT and GetConVarNumber("RD_UseLSTab") == 1) then TOOL.Tab = "Life Support" end

TOOL.ClientConVar['type'] = 'neutrions'
TOOL.ClientConVar['model'] = 'models/props/cs_assault/ACUnit01.mdll'

cleanup.Register('DWstoragedevice')

if ( CLIENT ) then
	language.Add( 'Tool_domreceptacles_name', 'Dominion Wars Life Support Storage Devices' )
	language.Add( 'Tool_domreceptacles_desc', 'Create Storage Devices attached to any surface.' )
	language.Add( 'Tool_domreceptacles_0', 'Left-Click: Spawn a Device.  Right-Click: Repair Device.' )

	language.Add( 'Undone_domreceptacles', 'Dominion Wars Storage Device Undone' )
	language.Add( 'Cleanup_domreceptacles', 'Dominion Wars LS: Storage Device' )
	language.Add( 'Cleaned_domreceptacles', 'Cleaned up all Dominion Wars Storage Devices' )
	language.Add( 'SBoxLimit_domreceptacles', 'Maximum Dominion Wars Storage Devices Reached' )
end

local domreceptacles = {}
if (SERVER) then

	domreceptacles.neutrions = function( ply, ent, system_type, system_class, model )
		local rtable, maxhealth, mass = {}, 0, 0
		if ( model == "models/props/cs_assault/ACUnit01.mdl" ) then
			maxhealth = 6000
			mass = 5000
			RD_AddResource(ent, "neutrions", 100000)
			
		elseif (model == "models/props/cs_assault/ACUnit02.mdl") then
			maxhealth = 2000
			mass = 1500
			RD_AddResource(ent, "neutrions", 50000)
		end			
		rtable.mass = mass
		LS_RegisterEnt(ent, "Storage")
		return rtable, maxhealth, mass
	end
end


local receptacle_models = {
	{ 'Huge Neutrion Storage Facility', 'models/props/cs_assault/ACUnit01.mdl', 'neutrions' },
	{ 'Large Neutrion Storage Facility', 'models/props/cs_assault/ACUnit02.mdl', 'neutrions' },
}

RD2_ToolRegister( TOOL, receptacle_models, nil, "domreceptacles", 5, domreceptacles )
